<?php

namespace app\services\portal;

use app\dao\portal\PortalMajorDao;
use app\exceptions\AdminException;
use app\services\BaseService;

class PortalMajorService extends BaseService
{

    public function __construct(PortalMajorDao  $dao)
    {
            $this -> dao = $dao;
    }

    public function index($where)
    {
        return $this -> dao -> index($where);
    }

    public function create(array $where)
    {
        $data =  $this ->dao -> create($where);
        if ($data) return $data;
        throw new AdminException('添加失败！');
    }

    public function update(array $where)
    {
        $data = $this ->dao ->updateDao($where);
        if ($data) return $data;
        throw new AdminException('更新失败！');

    }

    public function delete(array $where)
    {
        return $this ->dao ->deleteDao($where);
    }

    public function searchTitle(array $where)
    {
        return $this ->dao -> searchTitle($where);
    }

}